The technology described herein relates to graphics processing systems and in particular to the rendering of images using smooth shapes, such as smooth curves, in graphics processing systems.
It is becoming increasingly desirable in graphics processing systems to be able to render smooth shapes, and in particular shapes that are defined by smooth curves (that have a smooth curve as their edge or boundary), effectively and accurately for display. In general a shape with an edge or boundary curve that is continuous and where the first derivative of the curve is piecewise continuous can be considered to be a smooth shape (a shape defined by a smooth curve) from the point of view of graphics processing (and will be considered to be a smooth shape and, correspondingly, a smooth curve, for the purposes of the technology described herein and present application). Examples of such smooth curves in graphics processing are Bezier curves, spline curves and arcs.
In recent years it has become increasingly common to use vector graphics in computer graphics. As is known, in the art, one key advantage of vector graphics over raster graphics is the ability to provide resolution-independent images, i.e. images that can essentially be scaled indefinitely without degrading. For example, the individual characters (glyphs) in computer fonts, such as TrueType™, are typically stored as vector images.
Vector graphics are based on the use of individually defined geometrical objects, and are typically described by one or more line segments, e.g. straight lines or curves (such as quadratic (e.g. Bezier) curves, elliptical arcs, cubic (e.g. Bezier) curves) that are connected together at anchor points to form a path.
Vector graphics objects/paths are defined and manipulated in a space, commonly known as “world space”. In order to output the vector graphics objects/paths to a video display or printer, however, the objects/paths as defined in world space need to be converted into a suitable form so as to be displayed on a screen or to be outputted on a printer. This conversion typically involves projecting the objects/paths as defined in world space to another space, commonly referred to as “surface space”, that corresponds to the perspective (geometry) of the output display on which the objects/paths are to be viewed. The transformation between world space and surface space is typically referred to as the “world-to-surface transformation”.
Once the vector graphics objects/paths have been converted into surface space representations, they are then rendered, which may use a pre-computed representation of the objects and/or paths.
One method for converting the vector graphics objects/paths into a pre-computed representation which can then be used to render the object or path, e.g. in surface space, is to use a signed distance field, e.g. stored in a texture, which can then be sampled when rendering the object. A signed distance field contains an array of points, e.g. texels, for which the closest distance to the path or the edge of the object is stored for each point, with the sign of the distance denoting whether the point is within or outside the object to be rendered. Sampling the signed distance field therefore determines whether a sampling point falls within or outside the object to be rendered.
Signed distance fields aid the rendering of such objects, e.g. glyphs for fonts, and allow techniques such as anti-aliasing to be used. However, the calculation of the signed distance field from the vector graphics objects/paths, e.g. using scan-line rasterisation, is complicated. Also, if the object or path needs to be scaled, then the signed distance field may need to be re-calculated at the new resolution, because the signed distance field may only have been stored at a limited resolution. Furthermore, when rendering more complicated objects, e.g. glyphs for fonts which may comprise multiple curve segments, the use of signed distance fields has been found to result in a loss of detail in the rendered object, e.g. the smoothing of sharp corners, owing to artefacts in the method used to calculate the signed distance field. It is thus computationally expensive to calculate this in real time, or requires a lot of space to store the pre-calculated signed distance field offline. This may introduce latencies into the rendering of such objects/paths, which may be desired to perform in real time, e.g. for dynamic web pages.
The Applicants believe therefore that there remains scope for improved techniques and systems for rendering smooth curves and shapes defined by smooth curves.